var Dao = require('./DAO')
//针对用户的数据表操作的模块对象
var registerDAO = {

register:function(user,callback){
  console.log('11')
   Dao('insert into users(telephone,userPassword) values(?,'+' ? '+')',[user.userTel,user.userPwd],function(err,results){
     if(err){
       callback(err,null)
     }else{
       callback(null,results)
     }
   })
},
getUserByTel:function(userTel,callback){
  // console.log(user)
    Dao('select*from users where telephone = ?',[userTel],function(err,results){
      // console.log(results)
        if(err){
          callback(err,null)
        }else{
          callback(null,results)
        }
    })
  },
  forgetpwd:function(user,callback){
    Dao('update users set userPassword = ?  where telephone= ?',
  [user.userPwd,user.userTel],function(err,results){
      if(err){
        callback(err,null)
      }else{
        callback(null,results)
      }
    })
 },
}

module.exports = registerDAO